

class Cloth implements Comparable<Cloth>{
    private String color;
    private String name;
    private int price;

    public Cloth(String color,String name,int price){
        this.color=color;
        this.name=name;
        this.price=price;
    }

    @Override
    public int compareTo(Cloth o) {
        return this.price-o.price;
    }
}

public class Test {
    public static void main(String[] args) {
        Cloth shoe  = new Cloth("黑色","鸿星尔克",99);
        Cloth  coat = new Cloth("白色","李宁",100);
       int a= shoe.compareTo(coat);
        System.out.println(a);
        int b = coat.compareTo(shoe);
        System.out.println(b);
    }
}
